#include "script.h"
#include <stdio.h>

bool sq_runScript(char *path)
{
	FILE *f = fopen(path, "rb");
	if (!f)
		return FALSE;

	fseek(f, 0, SEEK_END);
	long len = ftell(f);
	fseek(f,0,SEEK_SET);

	char *tmp = new char[len+1];
	fread(tmp, len, 1, f);
	fclose(f);

	tmp[len] = 0;

	SquirrelObject obj = SquirrelVM::CompileBuffer(tmp);
	SquirrelVM::RunScript(obj);

	delete[] tmp;

	return TRUE;
}